package com.lenovo.dll.nebula.vod.parse.handler;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import com.lenovo.vod.model.Program;

public class PlayUrlHandler extends SaxHandler<String> implements IHandler<String>{
	
	String playUrl;
	
	public String getPlayUrl() {
		return playUrl;
	}

	public void setPlayUrl(String playUrl) {
		this.playUrl = playUrl;
	}
/*
	@Override
	public String getEntities(String result) {
		super.initParse(result);
		return playUrl;
	}
	*/
	@Override
	public List<String> getEntities(Map<String, String> params, String strUrl)
			throws ParserConfigurationException, SAXException, IOException {
		super.initParse(params, strUrl);
		List<String> s = new ArrayList<String>();
		s.add(playUrl);
		return s;
	}
	
	
	@Override
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException{

	}
		
	@Override
	public void endElement(String uri, String localName, String qName) throws SAXException{
		
	}
		
	@Override
	public void characters(char[] ch, int start, int length) throws SAXException{	
		
		//System.out.println(length+" "+new String(ch,start,length));		
		if(length<=36){
			return;
		}		
		playUrl=new String(ch, start, length);		
	}
	
}


